#pragma once

#include <stdarg.h>

class Log
{
public:
	Log(void);
	~Log(void);

	static void Info(char* format, ...)
	{
		va_list args;
		va_start(args, format);

		Write("log.txt", &info, format, args);

		va_end(args);
	}

	static void Stats(char* format, ...)
	{
		va_list args;
		va_start(args, format);

		Write("mes.txt", &measure, format, args);

		va_end(args);
	}

	

private:
	static FILE* info;
	static FILE* measure;

	static void Write(const char* fileName, FILE **f, char* format, va_list args)
	{
		if(*f == NULL)
		{
			*f = fopen(fileName, "a+");
		}

		if(f != NULL)
		{		
			vfprintf(*f, format, args);			
			fclose(*f);
			*f = NULL;
		}
	}
};

